﻿using Bussiness.Interface;
using Bussiness.Service;
using Common;
using Common.Model;
using Model;
using System;
using System.Collections.Generic;

public partial class Login : System.Web.UI.Page
{
    IBaseService baseService = new BaseService();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Login_Click(object sender, EventArgs e)
    {
        string UName = username.Value;
        string PW =MD5Encrypt.Encrypt(password.Value);
        Result<List<Users>> listresult = baseService.Select<Users>(p => p.UserName == UName, c => c.Password == PW);
        if (listresult.Data.Count > 0)
        {
            Session["user"] = listresult.Data[0];
            Response.Redirect("Index.aspx", false);
        }
        else
            Response.Write("用户名或密码出错");
    }
}